package Factory;

import Adapter.SmartWeederAdapter;
import Observer.EnvironmentSensorNetwork;

// 具体工厂实现
public class SmartMachineFactory implements MachineFactory {
    @Override
    public AgriculturalMachine createMachine(MachineType type, EnvironmentSensorNetwork sensorNetwork) {
        switch (type) {
            case SEEDER:
                return new SmartSeeder(sensorNetwork);
            case SPRAYER:
                return new SmartSprayer(sensorNetwork);
            case HARVESTER:
                return new SmartHarvester(sensorNetwork);
            case TRACTOR:
                return new SmartTractor(sensorNetwork);
            case WEEDER:
                // 创建智能除草机实例
                SmartWeederAdapter smartWeeder = new SmartWeederAdapter(sensorNetwork) ;
                return new SmartWeederAdapter(sensorNetwork);
            default:
                throw new IllegalArgumentException("不支持的农机类型: " + type);
        }
    }
}